﻿using System;
using System.Windows.Input;
using ClientOverflow.ViewModels.MainMenus;
using ClientOverflow.ViewModels.QuestionsListViewModels;

namespace ClientOverflow.ViewModels.UserProfileViewModels
{
    /// <summary>
    /// The command is executed to show all the questions in specific tag a user has been active in.
    /// </summary>
    internal class ShowQuestionsCommand : ICommand
    {
        private readonly IMenusViewModel viewModel;
        private readonly IQuestionsFilter questionsFilter;

        public ShowQuestionsCommand(IQuestionsFilter questionsFilter, IMenusViewModel viewModel)
        {
            this.viewModel = viewModel;
            this.questionsFilter = questionsFilter;
        }

        public void Execute(object parameter)
        {
            viewModel.Content = new QuestionsListViewModel(viewModel, questionsFilter);
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;
    }
}